import 'package:flutter/material.dart';

/// App颜色配置类
/// 统一管理应用中使用的所有颜色
class AppColors {
  // 私有构造函数，防止实例化
  AppColors._();

  // ==================== 主色调 ====================
  /// 主色调 - 黑色
  static const Color primary = Color(0xFF000000);
  
  /// 主色调变体 - 深灰色
  static const Color primaryVariant = Color(0xFF333333);

  /// 主色调变体 - 浅色灰色
  static const Color garyVariant = Color(0xFF999999);


  /// 次要色调 - 白色
  static const Color secondary = Color(0xFFF5F5F5);
  
  /// 次要色调变体 - 浅灰色
  static const Color secondaryVariant = Color(0xFFF5F5F5);

  // ==================== 按钮色调 ====================
  /// 主要按钮颜色
  static const Color buttonPrimary = Color(0xFF000000);
  
  /// 次要按钮颜色
  static const Color buttonSecondary = Color(0xFFFFFFFF);
  
  /// 按钮禁用状态颜色
  static const Color buttonDisabled = Color(0xFFCCCCCC);
  
  /// 按钮文字颜色 - 白色
  static const Color buttonTextPrimary = Color(0xFFFFFFFF);
  
  /// 按钮文字颜色 - 黑色
  static const Color buttonTextSecondary = Color(0xFF000000);

  // ==================== 文字颜色 ====================
  /// 主要文字颜色
  static const Color textPrimary = Color(0xFF000000);
  
  /// 次要文字颜色
  static const Color textSecondary = Color(0xFF666666);
  
  /// 提示文字颜色
  static const Color textHint = Color(0xFF999999);
  
  /// 禁用文字颜色
  static const Color textDisabled = Color(0xFFCCCCCC);
  
  /// 白色文字
  static const Color textWhite = Color(0xFFFFFFFF);

  // ==================== 背景颜色 ====================
  /// 主背景颜色
  static const Color background = Color(0xFFFFFFFF);

  static const Color backHomeYellowGround = Color(0xFFFFD900);


  /// 次要背景颜色
  static const Color backgroundSecondary = Color(0xFFF8F8F8);
  
  /// 卡片背景颜色
  static const Color backgroundCard = Color(0xFFFFFFFF);
  
  /// 搜索框背景颜色
  static const Color backgroundSearch = Color(0xFFF5F5F5);

  // ==================== 边框颜色 ====================
  /// 主要边框颜色
  static const Color border = Color(0xFFE0E0E0);
  
  /// 次要边框颜色
  static const Color borderSecondary = Color(0xFFF0F0F0);
  
  /// 分割线颜色
  static const Color divider = Color(0xFFEEEEEE);

  // ==================== 状态颜色 ====================
  /// 成功状态颜色
  static const Color success = Color(0xFF4CAF50);
  
  /// 警告状态颜色
  static const Color warning = Color(0xFFFF9800);
  
  /// 错误状态颜色
  static const Color error = Color(0xFFF44336);
  
  /// 信息状态颜色
  static const Color info = Color(0xFF2196F3);

  // ==================== 特殊颜色 ====================
  /// 阴影颜色
  static const Color shadow = Color(0x1A000000);
  
  /// 遮罩颜色
  static const Color overlay = Color(0x80000000);
  
  /// 选中状态颜色
  static const Color selected = Color(0xFF000000);
  
  /// 未选中状态颜色
  static const Color unselected = Color(0xFFCCCCCC);

  // ==================== 渐变色 ====================
  /// 主要渐变色
  static const LinearGradient primaryGradient = LinearGradient(
    colors: [Color(0xFF000000), Color(0xFF333333)],
    begin: Alignment.topLeft,
    end: Alignment.bottomRight,
  );
  
  /// 次要渐变色
  static const LinearGradient secondaryGradient = LinearGradient(
    colors: [Color(0xFFF5F5F5), Color(0xFFFFFFFF)],
    begin: Alignment.topLeft,
    end: Alignment.bottomRight,
  );

  // ==================== 颜色工具方法 ====================
  /// 获取颜色的透明度变体
  static Color withOpacity(Color color, double opacity) {
    return color.withOpacity(opacity);
  }
  
  /// 获取颜色的亮度变体
  static Color lighten(Color color, [double amount = 0.1]) {
    assert(amount >= 0 && amount <= 1);
    final hsl = HSLColor.fromColor(color);
    final hslLight = hsl.withLightness((hsl.lightness + amount).clamp(0.0, 1.0));
    return hslLight.toColor();
  }
  
  /// 获取颜色的暗度变体
  static Color darken(Color color, [double amount = 0.1]) {
    assert(amount >= 0 && amount <= 1);
    final hsl = HSLColor.fromColor(color);
    final hslDark = hsl.withLightness((hsl.lightness - amount).clamp(0.0, 1.0));
    return hslDark.toColor();
  }
}